package com.tengju.user.domain.model.user;

import java.util.Arrays;

public enum UserLevelEnum {
    /* 没有等级（游客） */
    NONE(0,"没有等级","游客"),

    /* 注册用户 */
    NORMAL(1, "注册用户","注册用户"),

    /* VIP */
    VIP(2, "VIP","粉卡"),

    /* VVIP */
    VVIP(3, "VVIP","白金"),

    /* SVIP */
    SVIP(4, "SVIP","黑钻"),

    /* 黑卡 */
    BLACK(5, "黑卡","黑钻PLUS");

    private int code;
    private String desc;
    private String levelDesc;

    private UserLevelEnum(int code, String desc, String levelDesc) {
        this.code = code;
        this.desc = desc;
        this.levelDesc = levelDesc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getLevelDesc() {
        return levelDesc;
    }

    public static UserLevelEnum getByCode(int code) {
        return Arrays.stream(UserLevelEnum.values()).filter(k->k.getCode() == code)
                .findFirst().orElse(null);
    }
}
